from guiHelp import *
from  main import main
from helpFunc import ini,clearDev
import  threading
from  datetime import  datetime



clearDev()
m = main()

def aa():
    print('start')
    while True:
        m.work()

t = threading.Thread(target=aa)
t.setDaemon(True)
t.start()

class myw(QWidget):
    def __init__(self):
        super().__init__()
        self.t = t = QTimer()
        t.timeout.connect(self.tt)
        t.start(1000)
        h = QHBoxLayout()
        self.tr = QTreeWidget()
        h.addWidget(self.tr)
        self.setLayout(h)

    def tt(self):
        fill_widget(self.tr, m.udpAddMap)
        print(datetime.now(),len(m.fackIpMap))






a = QApplication([])

w = myw()
w.show()
a.exec_()
